
package Presentation;


import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Group;
import javafx.scene.control.Menu;
import javafx.scene.control.MenuItem;
import javafx.stage.Stage;
import javafx.stage.WindowEvent;

public class MenuFavoris extends Menu
{
    
    FenetrePrincipale fp;
    MenuItem          afficherFavoris = new MenuItem("Afficher Favoris");
    
    public MenuFavoris(final FenetrePrincipale fp) {
    
        super("Favoris");
        this.fp = fp;
        this.getItems().addAll(afficherFavoris);
        afficherFavoris.setOnAction(new EventHandler<ActionEvent>()
        {
            
            public void handle(ActionEvent t) {
            
                Group    root1 = new Group();
                FenetreAfficherFavoris histo = new FenetreAfficherFavoris(root1,fp);
                Stage stage = new Stage();

                stage.setTitle("Favoris Navigation");
            

                stage.setWidth(450);
                stage.setHeight(510);  
                stage.setScene(histo);
                stage.show();
//                stage.setOnCloseRequest(new EventHandler<WindowEvent>()
//                {
//                    
//                    @Override
//                    public void handle(WindowEvent event) {
//                    
//                        fp.gestionNavigation.saveFavoris();
//                       
//                        System.out.println("sortir");
//                    }
//                });
            }
        });
    }
}
